const express = require('express')
const compression = require('compression')
const https = require('https')
const fs = require('fs')
const app = express()

const options = {
    cert: fs.readFileSync('./jielihaofeng-com.pem'),
    key: fs.readFileSync('./jielihaofeng-com-private.key')
}

// 一定要把这一行代码写到静态资源托管之前
app.use(compression())
app.use(express.static('./dist'))

app.listen(80,()=>{
    console.log('server running at http://127.0.0.1')
})

// https.createServer(options,app).listen(443)
// console.log('server running at https://127.0.0.1')
// 打开https://localhost报错： 访问 localhost 的请求遭到拒绝 您未获授权，无法查看此网页。HTTP ERROR 403
